home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / whisper / source / graphic.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-19  |  15.5 KB  |  701 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3. #include    <string.h>
  4. #include    <egb.h>
  5. #include    <mos.h>
  6. #include    <snd.h>
  7. #include    <msdos.cf>
  8. #include    "graphic.h"
  9.  
  10. #define    TRUE    1
  11. #define    FALSE    0
  12. #define    ERR    (-1)
  13.  
  14. char    *xopen(char *file);
  15. void    xclose(char *buf);
  16.  
  17. int    page_ofs=0;
  18. char    work[EgbWorkSize];
  19. char    mwork[MosWorkSize];
  20. char    swork[16384];
  21. int    col_cnv[]={
  22.     0x00000000,0x11111111,0x22222222,0x33333333,
  23.     0x44444444,0x55555555,0x66666666,0x77777777,
  24.     0x88888888,0x99999999,0xAAAAAAAA,0xBBBBBBBB,
  25.     0xCCCCCCCC,0xDDDDDDDD,0xEEEEEEEE,0xFFFFFFFF };
  26.  
  27. static int    mode_flg=FALSE;
  28. static int    now_mos_type=0;
  29. static char    mosptn[][66]={
  30.     { 2, 16,
  31.     0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 
  32.     0x30, 0x00, 0x58, 0x00, 0x3C, 0x00, 0x5E, 0x00, 
  33.     0x2F, 0x00, 0x5F, 0x80, 0x2E, 0x00, 0x7C, 0x00, 
  34.     0x66, 0x00, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 
  35.     0x7F, 0xFF, 0x3F, 0xFF, 0x5F, 0xFF, 0x6F, 0xFF, 
  36.     0x37, 0xFF, 0x5B, 0xFF, 0x3D, 0xFF, 0x5E, 0xFF, 
  37.     0x2F, 0x7F, 0x5F, 0xBF, 0x2E, 0x7F, 0x7D, 0xFF, 
  38.     0x66, 0xFF, 0x16, 0xFF, 0x7B, 0x7F, 0xF8, 0x7F },
  39.     { 2, 16,
  40.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 
  41.     0x05, 0x40, 0x05, 0x50, 0x15, 0x50, 0x15, 0x50, 
  42.     0x1F, 0xF0, 0x1F, 0xF0, 0x1F, 0xF0, 0x0F, 0xF0, 
  43.     0x07, 0xE0, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
  44.     0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xBF, 0xF5, 0x5F, 
  45.     0xF5, 0x4F, 0xE5, 0x57, 0xD5, 0x57, 0xD5, 0x57, 
  46.     0xDF, 0xF7, 0xDF, 0xF7, 0xDF, 0xF7, 0xEF, 0xF7, 
  47.     0xF7, 0xEF, 0xFB, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF },
  48.     { 2, 16,
  49.     0x00, 0x00, 0x2F, 0xF4, 0x2F, 0xF4, 0x2F, 0xF4, 
  50.     0x37, 0xEC, 0x39, 0x9C, 0x3C, 0x3C, 0x3E, 0x7C, 
  51.     0x3E, 0x7C, 0x3D, 0xBC, 0x3B, 0xDC, 0x36, 0x6C, 
  52.     0x2C, 0x34, 0x28, 0x14, 0x20, 0x04, 0x00, 0x00,
  53.     0x00, 0x00, 0xAF, 0xF5, 0xAF, 0xF5, 0xAF, 0xF5, 
  54.     0xB7, 0xED, 0xB9, 0x9D, 0xBC, 0x3D, 0xBE, 0x7D, 
  55.     0xBE, 0x7D, 0xBD, 0xBD, 0xBB, 0xDD, 0xB6, 0x6D, 
  56.     0xAC, 0x35, 0xA8, 0x15, 0xA0, 0x05, 0x00, 0x00 },
  57.     { 2, 16,
  58.     0x03, 0x00, 0x03, 0x80, 0x02, 0xC0, 0x02, 0x40, 
  59.     0x02, 0x40, 0x02, 0x00, 0x0E, 0x00, 0x1E, 0x00, 
  60.     0x1E, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6A, 0xE0, 
  61.     0x4A, 0xA0, 0x6A, 0xE0, 0x4A, 0x80, 0x6E, 0x80,
  62.     0xFB, 0x7F, 0xFB, 0xBF, 0xFA, 0xDF, 0xFA, 0x5F, 
  63.     0xFA, 0x5F, 0xE2, 0x9F, 0xCE, 0xFF, 0xDE, 0xFF, 
  64.     0xDE, 0xFF, 0xCD, 0xFF, 0xE1, 0xFF, 0xFF, 0xFF, 
  65.     0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
  66.     { 2, 16,
  67.     0x00, 0x00, 0x07, 0x00, 0x08, 0x80, 0x0A, 0x40, 
  68.     0x01, 0x40, 0x05, 0x40, 0x02, 0x40, 0x08, 0x40, 
  69.     0x04, 0x80, 0x07, 0x00, 0x00, 0x00, 0x75, 0x60, 
  70.     0x47, 0x50, 0x77, 0x50, 0x17, 0x50, 0x75, 0x60,
  71.     0xF0, 0x7F, 0xF7, 0x7F, 0xE8, 0xBF, 0xEA, 0x5F, 
  72.     0xE1, 0x5F, 0xE5, 0x5F, 0xE2, 0x5F, 0xE8, 0x5F, 
  73.     0xF4, 0xBF, 0xF7, 0x7F, 0xF0, 0x7F, 0xFF, 0xFF, 
  74.     0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } };
  75.  
  76. void    DSP_writePage(int pg)
  77. {
  78.     int     x,y,sw;
  79.  
  80.     MOS_rdpos(&sw,&x,&y);
  81.     MOS_disp(FALSE);
  82.     MOS_writePage(pg);
  83.     MOS_horizon(0,632);
  84.     MOS_vertical(0,464);
  85.     DSP_mos(now_mos_type);
  86.     MOS_setpos(x,y);
  87.     MOS_disp(TRUE);
  88.  
  89.     EGB_writePage(work,pg);
  90.     page_ofs = (pg == 0 ? 0:0x40000);
  91. }
  92.  
  93. void    DSP_mos(int no)
  94. {
  95.     MOS_type(1,0,0,mosptn[no]);
  96.     now_mos_type = no;
  97. }
  98.  
  99. BLOCK    *DSP_push_vram(int x1,int y1,int x2,int y2)
  100. {
  101.     register BLOCK *para;
  102.     int     n;
  103.  
  104.     n = ((x2 - x1 + 8) / 8 * 4) * (y2 - y1 + 1) + 16;    /* 4 Bit Pix */
  105.  
  106.     if ( (para = (BLOCK *)malloc(n)) == NULL )
  107.     return NULL;
  108.  
  109.     para->ptn = para->img;
  110.     para->sel = getds();
  111.     para->x1 = x1;
  112.     para->y1 = y1;
  113.     para->x2 = x2;
  114.     para->y2 = y2;
  115.     EGB_getBlock(work,(char *)para);
  116.     return para;
  117. }
  118.  
  119. void    DSP_pop_vram(BLOCK *para)
  120. {
  121.     if ( para == NULL )
  122.     return;
  123.     EGB_putBlock(work,0,(char *)para);
  124.     free(para);
  125. }
  126.  
  127. void    DSP_putptn(char *ptn,int x,int y,int col,int md)
  128. {
  129.     BLOCK para;
  130.  
  131.     para.ptn = ptn;
  132.     para.sel = getds();
  133.     para.x1 = x;
  134.     para.y1 = y;
  135.     para.x2 = x + 7;
  136.     para.y2 = y + 15;
  137.     EGB_color(work,0,col);
  138.     EGB_writeMode(work,md);
  139.     EGB_putBlockColor(work,0,(char *)(¶));
  140.     EGB_writeMode(work,0);
  141. }
  142.  
  143. void    DSP_msg(char *str,int x,int y,int font,int forcol,int bakcol)
  144. {
  145.     struct {
  146.     short int    x,y;
  147.     short int    len;
  148.     char        str[120];
  149.     } msg;
  150.  
  151.     msg.x = x;
  152.     msg.y = y;
  153.     msg.len = strlen(str);
  154.     strcpy(msg.str,str);
  155.  
  156.     EGB_fontStyle(work,font);
  157.     EGB_color(work,0,forcol);
  158.     EGB_color(work,1,bakcol);
  159.     EGB_sjisString(work,(char *)&msg);
  160. }
  161.  
  162. void    DSP_box(int x1,int y1,int x2,int y2,
  163.         int forcol,int boxcol)
  164. {
  165.     struct {
  166.     short int    x1,y1,x2,y2;
  167.     } line;
  168.     struct {
  169.     short int    count;
  170.     short int    x1,y1,x2,y2,x3,y3,x4,y4;
  171.     } connect;
  172.  
  173.     line.x1 = x1+1;
  174.     line.y1 = y1+1;
  175.     line.x2 = x2-1;
  176.     line.y2 = y2-1;
  177.     EGB_paintMode(work,0x020);
  178.     EGB_color(work,2,boxcol);
  179.     EGB_rectangle(work,(char *)&line);
  180.  
  181.     connect.count = 4;
  182.     connect.x1 = x1;
  183.     connect.y1 = y2-1;
  184.     connect.x2 = x1;
  185.     connect.y2 = y1+1;
  186.     connect.x3 = x1+1;
  187.     connect.y3 = y1;
  188.     connect.x4 = x2-1;
  189.     connect.y4 = y1;
  190.     EGB_paintMode(work,0x002);
  191.     EGB_color(work,0,forcol);
  192.     EGB_connect(work,(char *)&connect);
  193.  
  194.     connect.x1 = x2;
  195.     connect.y1 = y1+1;
  196.     connect.x2 = x2;
  197.     connect.y2 = y2-1;
  198.     connect.x3 = x2-1;
  199.     connect.y3 = y2;
  200.     connect.x4 = x1+1;
  201.     connect.y4 = y2;
  202.     EGB_connect(work,(char *)&connect);
  203. }
  204.  
  205. void    DSP_line(int x1,int y1,int x2,int y2,int col,int mod)
  206. {
  207.     struct {
  208.     short int    x1,y1,x2,y2;
  209.     } line;
  210.  
  211.     line.x1 = x1;
  212.     line.y1 = y1;
  213.     line.x2 = x2;
  214.     line.y2 = y2;
  215.     EGB_paintMode(work,0x002);
  216.     EGB_color(work,0,col);
  217.     EGB_writeMode(work,mod);
  218.     EGB_rectangle(work,(char *)&line);
  219.     EGB_writeMode(work,0);
  220. }
  221.  
  222. void    DSP_xline(int x1,int y1,int x2,int y2,int col,int mod)
  223. {
  224.     struct {
  225.     short int    x1,y1,x2,y2;
  226.     } line;
  227.  
  228.     line.x1 = x1;
  229.     line.y1 = y1;
  230.     line.x2 = x2;
  231.     line.y2 = y2;
  232.     EGB_paintMode(work,0x022);
  233.     EGB_color(work,0,col);
  234.     EGB_color(work,2,col);
  235.     EGB_writeMode(work,mod);
  236.     EGB_rectangle(work,(char *)&line);
  237.     EGB_writeMode(work,0);
  238. }
  239.  
  240. void    DSP_opline(x1,y1,x2,y2)
  241. {
  242.     int     i;
  243.     int     ix1,iy1,ix2,iy2;
  244.     int     sx1,sy1,sx2,sy2;
  245.  
  246.     ix1 = (x1 + x2) / 2 - 16;
  247.     ix2 = ix1 + 31;
  248.     iy1 = (y1 + y2) / 2 - 16;
  249.     iy2 = iy1 + 31;
  250.  
  251.     sx1 = (ix1 - x1) / 5;
  252.     sy1 = (iy1 - y1) / 5;
  253.     sx2 = (x2 - ix2) / 5;
  254.     sy2 = (y2 - iy2) / 5;
  255.  
  256.     for ( i = 5 ; i >= 0 ; i-- ) {
  257.     DSP_line(ix1,iy1,ix2,iy2,15,4);
  258.     EGB_displayStart(work,1,0,0);
  259.     DSP_line(ix1,iy1,ix2,iy2,15,4);
  260.     ix1 -= sx1;
  261.     iy1 -= sy1;
  262.     ix2 += sx2;
  263.     iy2 += sy2;
  264.     }
  265. }
  266.  
  267. void    DSP_rbox(int x1,int y1,int x2,int y2,
  268.         int forcol,int bakcol,int boxcol)
  269. {
  270.     struct {
  271.     short int    x1,y1,x2,y2;
  272.     } line;
  273.     struct {
  274.     short int    count;
  275.     short int    x1,y1,x2,y2,x3,y3;
  276.     } connect;
  277.  
  278.     DSP_opline(x1,y1,x2,y2);
  279.  
  280.     line.x1 = x1;
  281.     line.y1 = y1;
  282.     line.x2 = x2;
  283.     line.y2 = y2;
  284.     EGB_paintMode(work,0x022);
  285.     EGB_color(work,0,forcol);
  286.     EGB_color(work,2,boxcol);
  287.     EGB_rectangle(work,(char *)&line);
  288.  
  289.     connect.count = 3;
  290.     connect.x1 = x1+1;
  291.     connect.y1 = y2-1;
  292.     connect.x2 = x1+1;
  293.     connect.y2 = y1+1;
  294.     connect.x3 = x2-1;
  295.     connect.y3 = y1+1;
  296.     EGB_connect(work,(char *)&connect);
  297.  
  298.     connect.x1 = x1;
  299.     connect.y1 = y2;
  300.     connect.x2 = x2;
  301.     connect.y2 = y2;
  302.     connect.x3 = x2;
  303.     connect.y3 = y1;
  304. /*    EGB_color(work,0,bakcol); */
  305.     EGB_connect(work,(char *)&connect);
  306.     connect.x1 = x1+1;
  307.     connect.y1 = y2-1;
  308.     connect.x2 = x2-1;
  309.     connect.y2 = y2-1;
  310.     connect.x3 = x2-1;
  311.     connect.y3 = y1+1;
  312.     EGB_connect(work,(char *)&connect);
  313. }
  314.  
  315. static struct _PLT {
  316.     char    b,r,g;
  317.     } plt_tbl[16]={
  318.     { 0x20,0x20,0x20 },{ 0x70,0x00,0x80 },
  319.     { 0x90,0xD0,0x80 },{ 0x80,0x70,0x60 },
  320.     { 0x50,0x00,0x70 },{ 0x50,0x00,0x40 },
  321.     { 0xF0,0x00,0xF0 },{ 0x80,0x80,0x80 },
  322.     { 0x70,0xC0,0x40 },{ 0x50,0x00,0x50 },
  323.     { 0x70,0xC0,0x60 },{ 0x50,0x50,0x30 },
  324.     { 0x10,0x10,0x40 },{ 0x70,0x00,0x60 },
  325.     { 0xC0,0x60,0xC0 },{ 0xF0,0xF0,0xF0 }
  326.     };
  327.  
  328. void    DSP_palette(void)
  329. {
  330.     struct {
  331.     int    cnt;
  332.     int    col;
  333.     char    b,r,g;
  334.     char    btm;
  335.     } para;
  336.     int     i;
  337.  
  338.     for ( i = 0 ; i < 16 ; i++ ) {
  339.     para.cnt = 1;
  340.     para.col = i;
  341.     para.b = plt_tbl[i].b;
  342.     para.r = plt_tbl[i].r;
  343.     para.g = plt_tbl[i].g;
  344.     para.btm = 0;
  345.         EGB_palette(work,0,(char *)¶);
  346.     }
  347. }
  348.  
  349. void    DSP_one_pal(int c,int r,int g,int b)
  350. {
  351.     struct {
  352.     int    cnt;
  353.     int    col;
  354.     char    b,r,g;
  355.     char    btm;
  356.     } para;
  357.  
  358.     para.cnt = 1;
  359.     para.col = c;
  360.     para.b = b << 4;
  361.     para.r = r << 4;
  362.     para.g = g << 4;
  363.     para.btm = 0;
  364.     EGB_writePage(work,1);
  365.     EGB_palette(work,0,(char *)¶);
  366.     EGB_writePage(work,0);
  367. }
  368.  
  369. void    DSP_init(void)
  370. {
  371.     FILE    *fp;
  372.  
  373.     SND_init(swork);
  374.     SND_elevol_mute(0xB3);
  375.  
  376.     EGB_init(work,EgbWorkSize);
  377.     EGB_resolution(work,0,3);
  378.     EGB_resolution(work,1,3);
  379.     EGB_displayPage(work,1,3);
  380.  
  381.     MOS_start(mwork,MosWorkSize);
  382.     MOS_resolution(0,3);
  383.     MOS_resolution(1,3);
  384.     MOS_writePage(0);
  385.     MOS_horizon(0,632);
  386.     MOS_vertical(0,470);
  387.     MOS_type(1,0,0,mosptn[0]);
  388.  
  389.     if ( (fp = fopen("PLAT.TBL","rb")) != NULL ) {
  390.     fread(plt_tbl,sizeof(struct _PLT),16,fp);
  391.     fclose(fp);
  392.     }
  393.  
  394.     EGB_writePage(work,0);
  395.     DSP_palette();
  396.  
  397.     ctblset(col_cnv[15],0);
  398.  
  399.     wrtstr("ちょっと待ってね・・・・・",
  400.     page_ofs,200/2+220*512,col_cnv[15],col_cnv[0],16);
  401. }
  402. void    DSP_reinit(void)
  403. {
  404.     EGB_init(work,EgbWorkSize);
  405.     EGB_resolution(work,0,3);
  406.     EGB_resolution(work,1,3);
  407.     EGB_displayPage(work,1,3);
  408.     EGB_writePage(work,0);
  409.     DSP_palette();
  410. }
  411. void    DSP_end(void)
  412. {
  413.     MOS_end();
  414.     SND_elevol_mute(0x00);
  415.     SND_end();
  416. }
  417. void    DSP_mode_chk(int len)
  418. {
  419.     if ( len == 16 && mode_flg == FALSE ) {
  420.         EGB_resolution(work,1,10);
  421.     EGB_writePage(work,0);
  422.     DSP_palette();
  423.     EGB_writePage(work,1);
  424.     EGB_displayStart(work,0,160,120);
  425.     mode_flg = TRUE;
  426.     }
  427.     if ( len != 16 && mode_flg != FALSE ) {
  428.         EGB_resolution(work,1,3);
  429.     EGB_writePage(work,0);
  430.     DSP_palette();
  431.     mode_flg = FALSE;
  432.     }
  433.     EGB_writePage(work,1);
  434.     EGB_color(work,1,0);
  435.     EGB_clearScreen(work);
  436.     EGB_writePage(work,0);
  437. }
  438. void    DSP_push_tiff(char *file)
  439. {
  440.     int        l,n;
  441.     int     x,y,len;
  442.     BLOCK   para;
  443.     char    *buf;
  444.     struct _TIF {
  445.     short    tf_tag;
  446.     short    tf_type;
  447.     int    tf_len;
  448.     int    tf_data;
  449.     } *ifd;
  450.  
  451.     if ( (buf = xopen(file)) == NULL )
  452.     return;
  453.  
  454.     if ( buf[0] != 0x49 || buf[1] != 0x49 || buf[2] != 0x2A )
  455.     goto ENDOF;
  456.  
  457.     x = y = len = 0;
  458.     n = WORD(buf + DWORD(buf+4));
  459.     ifd = (struct _TIF *)(buf + DWORD(buf+4) + 2);
  460.  
  461.     while ( n-- > 0) {
  462.     if ( ifd->tf_tag == 0 )
  463.         break;
  464.     switch(ifd->tf_tag){
  465.     case 0x0100: x = ifd->tf_data; break;
  466.     case 0x0101: y = ifd->tf_data; break;
  467.     case 0x0102: len = ifd->tf_data; break;
  468.     case 0x0111: l = ifd->tf_data; break;
  469.     }
  470.     ifd++;
  471.     }
  472.  
  473.     para.ptn = buf + l;
  474.     para.sel = getds();
  475.     para.x1 = 0;
  476.     para.y1 = 0;
  477.     para.x2 = x-1;
  478.     para.y2 = y-1;
  479.  
  480.     DSP_mode_chk(len);
  481.     EGB_writePage(work,1);
  482.     EGB_putBlock(work,0,(char *)¶);
  483.     EGB_writePage(work,0);
  484.  
  485. ENDOF:
  486.     xclose(buf);
  487. }
  488.  
  489. void    DSP_pop_tiff(void)
  490. {
  491.     EGB_writePage(work,1);
  492.     EGB_color(work,1,0);
  493.     EGB_clearScreen(work);
  494.     if ( mode_flg != FALSE )
  495.         EGB_resolution(work,1,3);
  496.     EGB_writePage(work,0);
  497.     DSP_palette();
  498.     EGB_displayPage(work,1,3);
  499.     mode_flg = FALSE;
  500. }
  501.  
  502. void    DSP_anime(char *file)
  503. {
  504.     char    *buf;
  505.  
  506.     if ( (buf = xopen(file)) == NULL )
  507.     return;
  508.  
  509.     DSP_mode_chk(*buf);
  510.     ANI_decode(0x40000,buf+1);
  511.     xclose(buf);
  512. }
  513.  
  514. #include    "event.h"
  515.  
  516. #define    PLT_X    280
  517. #define    PLT_Y    320
  518. #define    PLT_BX    (PLT_X+324)
  519. #define    PLT_BY    (PLT_Y+108)
  520.  
  521. void    PLT_col();
  522.  
  523. static int plt_event=FALSE;
  524.  
  525. void    PLT_event(register EVENT *ep,int x,int y,int sw)
  526. {
  527.     switch(ep->now) {
  528.     case EVT_CLIP_MOS:
  529.     EVT_clip_on(ep);
  530.     case EVT_ON_MOS:
  531.     DSP_mos(1);
  532.     break;
  533.  
  534.     case EVT_SELECT_MOS:
  535.     EVT_clip_off(ep);
  536.     DSP_mos(0);
  537.     if ( ep->level == 516 ) {
  538.         plt_event = ERR;
  539.         break;
  540.     }
  541.     switch(ep->no){
  542.     case 0: plt_tbl[ep->level-500].b+=16; break;
  543.     case 1: plt_tbl[ep->level-500].b-=16; break;
  544.     case 2: plt_tbl[ep->level-500].r+=16; break;
  545.     case 3: plt_tbl[ep->level-500].r-=16; break;
  546.     case 4: plt_tbl[ep->level-500].g+=16; break;
  547.     case 5: plt_tbl[ep->level-500].g-=16; break;
  548.     }
  549.     PLT_col(ep->level-500);
  550.     EGB_writePage(work,0);
  551.     DSP_palette();
  552.     break;
  553.  
  554.     case EVT_DOLACK_MOS:
  555.     ep->now = EVT_NON;
  556.     case EVT_MOVE_MOS:
  557.     EVT_clip_off(ep);
  558.     case EVT_OFF_MOS:
  559.     DSP_mos(0);
  560.     break;
  561.     }
  562. }
  563.  
  564. void    PLT_col(int col)
  565. {
  566.     int    x,y,c;
  567.     char   tmp[40];
  568.  
  569.     MOS_disp(FALSE);
  570.  
  571.     x = PLT_X + (col % 8) * 40 + 8;
  572.     y = PLT_Y + (col / 8) * 50 + 18;
  573.     c = (col == 8 ? 0 : col);
  574.  
  575.     sprintf(tmp,"\x1B\x87%2d\x1B\x87",col);
  576.     DSP_string(tmp,x,y+2,c,8);
  577.     sprintf(tmp,"<%02d>",plt_tbl[col].b>>4);
  578.     DSP_string(tmp,x,y+10,c,8);
  579.     sprintf(tmp,"<%02d>",plt_tbl[col].r>>4);
  580.     DSP_string(tmp,x,y+18,c,8);
  581.     sprintf(tmp,"<%02d>",plt_tbl[col].g>>4);
  582.     DSP_string(tmp,x,y+26,c,8);
  583.  
  584.     EVT_level_free(500+col);
  585.     EVT_set_node(x,y+10,x+7,y+17,500+col,PLT_event,0);
  586.     EVT_set_node(x+24,y+10,x+31,y+17,500+col,PLT_event,1);
  587.  
  588.     EVT_set_node(x,y+18,x+7,y+25,500+col,PLT_event,2);
  589.     EVT_set_node(x+24,y+18,x+31,y+25,500+col,PLT_event,3);
  590.  
  591.     EVT_set_node(x,y+26,x+7,y+33,500+col,PLT_event,4);
  592.     EVT_set_node(x+24,y+26,x+31,y+33,500+col,PLT_event,5);
  593.  
  594.     MOS_disp(TRUE);
  595. }
  596.  
  597. void    PLT_set(void)
  598. {
  599.     int     i;
  600.     BLOCK   *save;
  601.     FILE    *fp;
  602.  
  603.     MOS_disp(FALSE);
  604.     save = DSP_push_vram(PLT_X,PLT_Y,PLT_BX,PLT_BY);
  605.     DSP_box(PLT_X,PLT_Y,PLT_BX,PLT_BY,7,8);
  606.  
  607.     EVT_sw(PLT_X+2,PLT_Y+2,"END",15,8,516,PLT_event,0);
  608.  
  609.     for ( i = 0 ; i < 16 ; i++ )
  610.         PLT_col(i);
  611.  
  612.     for ( plt_event = FALSE ; plt_event == FALSE ; )
  613.     EVT_loop(500);
  614.  
  615.     for ( i = 0 ; i <= 16 ; i++ )
  616.         EVT_level_free(500+i);
  617.  
  618.     MOS_disp(FALSE);
  619.     DSP_pop_vram(save);
  620.  
  621.     if ( (fp = fopen("PLAT.TBL","wb")) != NULL ) {
  622.     fwrite(plt_tbl,sizeof(struct _PLT),16,fp);
  623.     fclose(fp);
  624.     }
  625. }
  626.  
  627. void    DSP_super(char *str)
  628. {
  629.     struct {
  630.     int    cnt;
  631.     int    col;
  632.     char    b,r,g;
  633.     char    btm;
  634.     } para;
  635.     int     i;
  636.     static int ofs_y=0;
  637.  
  638.     EGB_writePage(work,1);
  639.     page_ofs = 0x40000;
  640.  
  641.     if ( str == NULL ) {
  642.     para.cnt = 1;
  643.     para.col = 15;
  644.     para.btm = 0;
  645.     for ( i = 255 ; i >= 0 ; i -= 8 ) {
  646.         para.b = para.r = para.g = i & 0xF0;
  647.             EGB_palette(work,0,(char *)¶);
  648.         EGB_displayStart(work,1,0,ofs_y);
  649.     }
  650.     EGB_color(work,1,0);
  651.     EGB_clearScreen(work);
  652.     para.b = para.r = para.g = 0xF0;
  653.         EGB_palette(work,0,(char *)¶);
  654.     EGB_displayStart(work,1,0,0);
  655.         EGB_displayPage(work,1,3);
  656.     ofs_y = 0;
  657.     } else {
  658.     EGB_displayPage(work,1,2);
  659.     i = ((480 + ofs_y) & 511) * 512;
  660.     putstr(i,str);
  661.     for ( i = 0 ; i < 16 ; i++ ) {
  662.         EGB_displayStart(work,1,0,ofs_y++);
  663.         ofs_y &= 511;
  664.     }
  665.     }
  666.  
  667.     EGB_writePage(work,0);
  668.     page_ofs = 0;
  669. }
  670.  
  671. void    DSP_pause(int x,int y,int cl,int bk,char *str)
  672. {
  673.     int     i,n;
  674.     char    tmp[4];
  675.  
  676.     EGB_writePage(work,1);
  677.     page_ofs = 0x40000;
  678.     EGB_displayPage(work,1,2);
  679.  
  680.     while ( *str != '\0' ) {
  681.     if ( iskan(str) ) {
  682.         tmp[0] = *(str++);
  683.         tmp[1] = *(str++);
  684.         tmp[2] = '\0';
  685.         n = 16;
  686.     } else {
  687.         tmp[0] = *(str++);
  688.         tmp[1] = '\0';
  689.         n = 8;
  690.     }
  691.     wrtstr(tmp,page_ofs,x/2+y*512,col_cnv[cl],col_cnv[bk],16);
  692.     x += n;
  693.  
  694.     for ( i = 0 ; i < 8 ; i++ )
  695.         EGB_displayStart(work,1,0,0);
  696.     }
  697.  
  698.     EGB_writePage(work,0);
  699.     page_ofs = 0;
  700. }
  701.